/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clients;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

/**
 *
 * @author Cliff
 */
public class Client {
    private String userName;
    private long id;
    private String address;
    private int port;
    private Socket clientSocket;
    private BufferedReader in;
    private PrintWriter out;
    
    /**
     * 
     * @param clientSocket
     * @param id 
     */
    public Client(Socket clientSocket, int id){
        this.clientSocket = clientSocket;
        this.id = id;
        this.address = this.clientSocket.getInetAddress().getHostAddress();
        this.port = this.clientSocket.getPort();
    }

    /**
     * 
     * @param clientSocket
     * @param in
     * @param out
     * @param id 
     */
    public Client(Socket clientSocket, BufferedReader in, PrintWriter out, int id) {
        this.clientSocket = clientSocket;
        this.id = id;
        this.in = in;
        this.out = out;
        this.address = this.clientSocket.getInetAddress().getHostAddress();
        this.port = this.clientSocket.getPort();
    }
    
    public void disconnect() throws IOException{
        this.clientSocket.close();
    }

    /**
     * @return the userName
     */
    public String getUserName() {
        return userName;
    }

    /**
     * @param userName the userName to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * @return the address
     */
    public String getAddress() {
        return address;
    }

    /**
     * @return the port
     */
    public int getPort() {
        return port;
    }

    /**
     * @return the clientSocket
     */
    public Socket getClientSocket() {
        return clientSocket;
    }

    /**
     * @return the id
     */
    public long getId() {
        return id;
    }
    
    
    
}
